<?php
include("common/common.php");

$email=$_POST["uemail"];
$passwd=$_POST["upasswd"];

$remail=$_POST["ureemail"];
$rpasswd=$_POST["urepasswd"];

if($email!=$remail){
	$email = '';
}
if($passwd!=$rpasswd){
	$passwd = '';
}

$sex=$_POST["usex"];
$nom=$_POST["unom"];
$prenom=$_POST["uprenom"];
$zip=$_POST["uzip"];
$tel=$_POST["utel"];

if (strlen($email)>0)
$data['email'] = $email;
if (strlen($passwd)>0)
$data['psword'] = $passwd;
if (strlen($sex)>0)
$data['sex'] = $sex;
if (strlen($nom)>0)
$data['nom'] = $nom;
if (strlen($prenom)>0)
$data['prenom'] = $prenom;
if (strlen($tel)>0)
$data['tel'] = $tel;
if (strlen($zip)>0)
$data['zip'] = $zip;


$_user = $_COOKIE['_user'];

$db = Database::obtain(DB_SERVER, DB_USER, DB_PASS, DB_DATABASE);
$db->connect();
$db->update("user_info", $data,"email='".$_user."'");
$db->close();
if (strlen($email)>0){
	setcookie('_user', $email);
}
redirect("user.php");


?>
